package string;

public class StringBuilderDemo {
    public static void main(String[] args) {

        StringBuilder builder=new StringBuilder("好好学习java");
        /*
        System.out.println(builder);

        builder.append(",为了找个好工作");
        System.out.println(builder);

        String str = builder.toString();
        System.out.println(str);

        //replace:替换操作,将指定范围
        builder.replace(9,16, "就是为了改变世界");
        System.out.println(builder);
        //删除
        builder.delete(0,9);
        System.out.println(builder);

        builder.insert(2,"活着");
        System.out.println(builder);

        builder.reverse();
        System.out.println(builder);
    }
    */

        builder.append(",为了找个好工作")
                .replace(9,16,"就是为了改变sj")
                .delete(0,8)
                .insert(0,"活着")
                .reverse();
        System.out.println(builder);




    }
}

